Q<template>
	<view class="container">
		<view class="head">
			<u-navbar title="登录" :autoBack="false" :border="true">
				<view class="left" slot="left">

				</view>
			</u-navbar>
		</view>
		<view class="content">
			<view class="login_head">
				<image src="/static/img/logo.png" mode=""></image>
			</view>
			<view class="login_inp">
				<label>账号：</label><input type="text" placeholder="请输入账号" v-model="value">
			</view>
			<view class="login_inp">
				<label>密码：</label><input type="password" placeholder="请输入密码" v-model="value1">
			</view>
			<view class="btn">
				<button @click="login">登录</button>
			</view>
			<!-- 			<view class="check">
				<u-checkbox-group v-model="checkboxValue1" @change="checkboxChange" placement="row">
					<u-checkbox :customStyle="{marginBottom: '8px'}" :name="checked" size="38" iconSize="20">
					</u-checkbox>
					<view class="text">
						我已阅读并同意<text @click="gorules(1)">《用户协议》</text>和<text @click="gorules(2)">《隐私政策》</text>
					</view>
				</u-checkbox-group>
			</view> -->
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				checkboxValue1: [0],
				checked: 1,
				value: '',
				value1: ''
			};
		},
		methods: {
			//微信登录
			login() {
				if (this.value == '') {
					this.$toast('请输入账号后登录')
					return false
				}
				if (this.value1 == '') {
					this.$toast('请输入密码后登录')
					return false
				}
				if (this.checkboxValue1.length == 0) {
					this.$toast('请阅读并同意相关政策')
					return false
				}
				this.$login({
					account: this.value,
					password: this.value1
				}).then(res => {
					this.$toast(res.msg)
					if (res.code == 1) {
						uni.setStorageSync('userinfo', res.data.userinfo)
						uni.setStorageSync('token', res.data.userinfo.token)
						setTimeout(item => {
							uni.switchTab({ url: '/pages/i2/truck_list/truck_list' })
						}, 500)
					} else {
						// this.value = ''
						this.value1 = ''
					}
				})
			},
			//用户协议
			gorules(data) {
				uni.navigateTo({ url: "/pages/rules/rules?type=" + data })
			},
			checkboxChange(n) {
				console.log('groupChange', n);
			},
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #fff;
	}

	.container {
		.content {
			padding: 156rpx 0;
			display: flex;
			flex-direction: column;
			align-items: center;

			.login_head {
				margin-top: 160rpx;

				image {
					width: 300rpx;
					height: 300rpx;
					border-radius: 10rpx;
				}
			}

			.login_inp {
				display: flex;
				margin-top: 40rpx;
				align-items: center;

				input {
					border: #999 solid 1px;
					font-size: 30rpx;
					width: 500rpx;
					height: 70rpx;
					border-radius: 10rpx;
					padding-left: 20rpx;
				}

				label {
					font-size: 32rpx;
					font-weight: 500;
				}
			}

			.btn {
				margin-top: 60rpx;

				button {
					width: 700rpx;
					color: #fff;
					background: #1890FF;
				}
			}

			.check {
				margin-top: 140rpx;

				.text {
					font-size: 28rpx;

					text {
						color: #fd8008;
					}
				}
			}
		}
	}
</style>